#!/usr/bin/python
#-*- coding: UTF-8 -*-

"""
数据库表定义，在这里定义所有数据库表的类型
@author:sftang
"""

from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, Table, DateTime,ForeignKey,Numeric
from sqlalchemy.orm import relation, backref
 
from datetime import datetime

Base = declarative_base()


class Server(Base):
    """
    设备硬件信息
    """
    __tablename__ = 'server'
    id = Column(Integer, primary_key=True)
    server_sn = Column(String,unique=True, index=True, nullable=False)
    server_height = Column(Integer)
    server_asset_tag = Column(String)
    server_cdrom = Column(Integer)
    server_raidtype = Column(String)
    comment = Column(String)
    is_virtual = Column(Integer)
    
                    
    def __init__(self, server_sn, server_height, server_asset_tag,server_cdrom,server_raidtype,comment,is_virtual):
        self.server_sn = server_sn
        self.server_height = server_height
        self.server_asset_tag = server_asset_tag
        self.server_cdrom = server_cdrom
        self.server_raidtype = server_raidtype
        self.comment = comment
        self.is_virtual = is_virtual
    
    def __repr__(self):
        #return "(User('%s','%s', '%s'))" % (self.name, self.fullname, self.password)
        return "('%s', '%s','%s','%s','%s')" % (self.server_sn, self.server_height, self.server_asset_tag, \
                                                     self.server_cdrom, self.server_raidtype,self.comment, \
                                                     self.is_virtual)
    